package tt.dz.egobus.servicemanager.service.impl;

import org.springframework.stereotype.Service;
import tt.dz.egobus.api.ResponseBack;
import tt.dz.egobus.api.page.Page;
import tt.dz.egobus.api.page.Pageable;
import tt.dz.egobus.bean.comment.TagBack;
import tt.dz.egobus.bean.comment.TagRequest;
import tt.dz.egobus.servicemanager.base.service.AbstractFacadeServiceConfig;
import tt.dz.egobus.servicemanager.facade.interator.FacadeFactory;
import tt.dz.egobus.servicemanager.facade.interator.FacadeFactoryLoggerInterceptorHolder;
import tt.dz.egobus.servicemanager.facade.order.OrderFacade;
import tt.dz.egobus.servicemanager.service.OrderTagManagerService;

import javax.annotation.PostConstruct;
import java.util.List;

/**
 * @author Anson
 * @date 17-8-14
 * @name 基于dubbo实现的标签任务管理服务
 * @since 1.0.6
 */
@Service("dubboOrderTagManagerServiceImpl")
public class DubboOrderTagManagerServiceImpl extends AbstractFacadeServiceConfig implements OrderTagManagerService {

    @Override
    @PostConstruct
    protected FacadeFactory getFacadeFactory() {
        return FacadeFactoryLoggerInterceptorHolder.LOGGER_FACADE;
    }


    private OrderFacade getOrderFacade() {
        return this.facade("order", OrderFacade.class);
    }


    @Override
    public ResponseBack<TagBack> addTag(TagRequest request) {
        return this.getOrderFacade().addTag(request);
    }

    @Override
    public ResponseBack<List<TagBack>> getTagByLevel(int starLevel) {
        return this.getOrderFacade().getTagByLevel(starLevel);
    }

    @Override
    public ResponseBack<TagBack> updateTag(String tagId, String value) {
        return this.getOrderFacade().updateTag(tagId, value);
    }

    @Override
    public ResponseBack<Boolean> deleteTag(String tagId) {
        return this.getOrderFacade().deleteTag(tagId);
    }

    @Override
    public ResponseBack<Page<TagBack>> queryPage(Pageable pageable) {
        return this.getOrderFacade().queryPage(pageable);
    }


}
